<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>hashcat-3.201: H:/TDDownload/Hashcat v3.20/hashcat-3.201/src/cpu_crc32.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">hashcat-3.201
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_06fe396e3e859736df6d43ad26baa72e.html">hashcat-3.201</a></li><li class="navelem"><a class="el" href="dir_9ce3dfc5d638c7f8b2c4ec0f6627771b.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">cpu_crc32.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;common.h&quot;</code><br />
<code>#include &quot;types.h&quot;</code><br />
<code>#include &quot;memory.h&quot;</code><br />
<code>#include &quot;event.h&quot;</code><br />
<code>#include &quot;cpu_crc32.h&quot;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for cpu_crc32.c:</div>
<div class="dyncontent">
<div class="center"><img src="cpu__crc32_8c__incl.gif" border="0" usemap="#_h_1_2_t_d_download_2_hashcat_01v3_820_2hashcat-3_8201_2src_2cpu__crc32_8c" alt=""/></div>
<map name="_h_1_2_t_d_download_2_hashcat_01v3_820_2hashcat-3_8201_2src_2cpu__crc32_8c" id="_h_1_2_t_d_download_2_hashcat_01v3_820_2hashcat-3_8201_2src_2cpu__crc32_8c">
<area shape="rect"  title=" " alt="" coords="161,5,324,61"/>
<area shape="rect"  title=" " alt="" coords="5,109,88,136"/>
<area shape="rect"  title=" " alt="" coords="113,109,178,136"/>
<area shape="rect"  title=" " alt="" coords="203,109,283,136"/>
<area shape="rect"  title=" " alt="" coords="307,109,370,136"/>
<area shape="rect"  title=" " alt="" coords="395,109,488,136"/>
</map>
</div>
</div>
<p><a href="cpu__crc32_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a61504903c4144f98e49063d95c67dc60"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cpu__crc32_8c.html#a61504903c4144f98e49063d95c67dc60">MAX_KEY_SIZE</a>&#160;&#160;&#160;(1024 * 1024)</td></tr>
<tr class="separator:a61504903c4144f98e49063d95c67dc60"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a39546164f0fef90ab2b9683bdc2aac6b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cpu__crc32_8c.html#a39546164f0fef90ab2b9683bdc2aac6b">cpu_crc32</a> (hashcat_ctx_t *hashcat_ctx, const char *filename, u8 keytab[64])</td></tr>
<tr class="separator:a39546164f0fef90ab2b9683bdc2aac6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:abee14193c12696f5c727ef04607b75cc"><td class="memItemLeft" align="right" valign="top">static const u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cpu__crc32_8c.html#abee14193c12696f5c727ef04607b75cc">crc32tab</a> [256]</td></tr>
<tr class="separator:abee14193c12696f5c727ef04607b75cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a61504903c4144f98e49063d95c67dc60"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a61504903c4144f98e49063d95c67dc60">&#9670;&nbsp;</a></span>MAX_KEY_SIZE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MAX_KEY_SIZE&#160;&#160;&#160;(1024 * 1024)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a39546164f0fef90ab2b9683bdc2aac6b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a39546164f0fef90ab2b9683bdc2aac6b">&#9670;&nbsp;</a></span>cpu_crc32()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int cpu_crc32 </td>
          <td>(</td>
          <td class="paramtype">hashcat_ctx_t *&#160;</td>
          <td class="paramname"><em>hashcat_ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>keytab</em>[64]&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="cpu__crc32_8c_source.html#l00080">80</a> of file <a class="el" href="cpu__crc32_8c_source.html">cpu_crc32.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;{</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  u32 crc = ~0u;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;  FILE *fd = fopen (filename, <span class="stringliteral">&quot;rb&quot;</span>);</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;  <span class="keywordflow">if</span> (fd == NULL)</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;  {</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <a class="code" href="event_8c.html#ab419d8d7e9b12e78980ed9f17bdd5ed5">event_log_error</a> (hashcat_ctx, <span class="stringliteral">&quot;%s: %s&quot;</span>, filename, strerror (errno));</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="keywordflow">return</span> (-1);</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;  }</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="preprocessor">  #define MAX_KEY_SIZE (1024 * 1024)</span></div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;  u8 *buf = (u8 *) <a class="code" href="memory_8c.html#aac788cecd4f6c2a1524456f4a5db7cdc">hcmalloc</a> (<a class="code" href="cpu__crc32_8c.html#a61504903c4144f98e49063d95c67dc60">MAX_KEY_SIZE</a> + 1);</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;  <span class="keywordtype">size_t</span> nread = fread (buf, <span class="keyword">sizeof</span> (u8), <a class="code" href="cpu__crc32_8c.html#a61504903c4144f98e49063d95c67dc60">MAX_KEY_SIZE</a>, fd);</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  fclose (fd);</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;  <span class="keywordtype">size_t</span> kpos = 0;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> fpos = 0; fpos &lt; nread; fpos++)</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  {</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    crc = <a class="code" href="cpu__crc32_8c.html#abee14193c12696f5c727ef04607b75cc">crc32tab</a>[(crc ^ buf[fpos]) &amp; 0xff] ^ (crc &gt;&gt; 8);</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    keytab[kpos++] += (crc &gt;&gt; 24) &amp; 0xff;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    keytab[kpos++] += (crc &gt;&gt; 16) &amp; 0xff;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    keytab[kpos++] += (crc &gt;&gt;  8) &amp; 0xff;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    keytab[kpos++] += (crc &gt;&gt;  0) &amp; 0xff;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordflow">if</span> (kpos &gt;= 64) kpos = 0;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;  }</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  <a class="code" href="memory_8c.html#ad8ba3dcf1734b1d2c8679600f0f0c3c9">hcfree</a> (buf);</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;}</div><div class="ttc" id="memory_8c_html_ad8ba3dcf1734b1d2c8679600f0f0c3c9"><div class="ttname"><a href="memory_8c.html#ad8ba3dcf1734b1d2c8679600f0f0c3c9">hcfree</a></div><div class="ttdeci">void hcfree(void *ptr)</div><div class="ttdef"><b>Definition:</b> <a href="memory_8c_source.html#l00071">memory.c:71</a></div></div>
<div class="ttc" id="event_8c_html_ab419d8d7e9b12e78980ed9f17bdd5ed5"><div class="ttname"><a href="event_8c.html#ab419d8d7e9b12e78980ed9f17bdd5ed5">event_log_error</a></div><div class="ttdeci">size_t event_log_error(hashcat_ctx_t *hashcat_ctx, const char *fmt,...)</div><div class="ttdef"><b>Definition:</b> <a href="event_8c_source.html#l00168">event.c:168</a></div></div>
<div class="ttc" id="cpu__crc32_8c_html_a61504903c4144f98e49063d95c67dc60"><div class="ttname"><a href="cpu__crc32_8c.html#a61504903c4144f98e49063d95c67dc60">MAX_KEY_SIZE</a></div><div class="ttdeci">#define MAX_KEY_SIZE</div></div>
<div class="ttc" id="memory_8c_html_aac788cecd4f6c2a1524456f4a5db7cdc"><div class="ttname"><a href="memory_8c.html#aac788cecd4f6c2a1524456f4a5db7cdc">hcmalloc</a></div><div class="ttdeci">void * hcmalloc(const size_t sz)</div><div class="ttdef"><b>Definition:</b> <a href="memory_8c_source.html#l00024">memory.c:24</a></div></div>
<div class="ttc" id="cpu__crc32_8c_html_abee14193c12696f5c727ef04607b75cc"><div class="ttname"><a href="cpu__crc32_8c.html#abee14193c12696f5c727ef04607b75cc">crc32tab</a></div><div class="ttdeci">static const u32 crc32tab[256]</div><div class="ttdef"><b>Definition:</b> <a href="cpu__crc32_8c_source.html#l00012">cpu_crc32.c:12</a></div></div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="cpu__crc32_8c_source.html#l00012">crc32tab</a>, <a class="el" href="event_8c_source.html#l00168">event_log_error()</a>, <a class="el" href="memory_8c_source.html#l00071">hcfree()</a>, <a class="el" href="memory_8c_source.html#l00024">hcmalloc()</a>, and <a class="el" href="cpu__crc32_8c.html#a61504903c4144f98e49063d95c67dc60">MAX_KEY_SIZE</a>.</p>

<p class="reference">Referenced by <a class="el" href="interface_8c_source.html#l20021">hashconfig_general_defaults()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="cpu__crc32_8c_a39546164f0fef90ab2b9683bdc2aac6b_cgraph.gif" border="0" usemap="#cpu__crc32_8c_a39546164f0fef90ab2b9683bdc2aac6b_cgraph" alt=""/></div>
<map name="cpu__crc32_8c_a39546164f0fef90ab2b9683bdc2aac6b_cgraph" id="cpu__crc32_8c_a39546164f0fef90ab2b9683bdc2aac6b_cgraph">
<area shape="rect"  title=" " alt="" coords="5,81,88,108"/>
<area shape="rect"  href="event_8c.html#ab419d8d7e9b12e78980ed9f17bdd5ed5" title=" " alt="" coords="136,31,245,57"/>
<area shape="rect"  href="memory_8c.html#ad8ba3dcf1734b1d2c8679600f0f0c3c9" title=" " alt="" coords="162,81,219,108"/>
<area shape="rect"  href="memory_8c.html#aac788cecd4f6c2a1524456f4a5db7cdc" title=" " alt="" coords="153,132,228,159"/>
<area shape="rect"  href="event_8c.html#ad5a30ac9dc4301540e19643500eb78e4" title=" " alt="" coords="295,5,371,32"/>
<area shape="rect"  href="event_8c.html#a6221c6caa1d2069ad1c3103f0b013ef7" title=" " alt="" coords="293,56,372,83"/>
</map>
</div>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="cpu__crc32_8c_a39546164f0fef90ab2b9683bdc2aac6b_icgraph.gif" border="0" usemap="#cpu__crc32_8c_a39546164f0fef90ab2b9683bdc2aac6b_icgraph" alt=""/></div>
<map name="cpu__crc32_8c_a39546164f0fef90ab2b9683bdc2aac6b_icgraph" id="cpu__crc32_8c_a39546164f0fef90ab2b9683bdc2aac6b_icgraph">
<area shape="rect"  title=" " alt="" coords="820,13,903,39"/>
<area shape="rect"  href="interface_8c.html#af7db878930b6c9ae042a0a1b9b8fe24c" title=" " alt="" coords="639,5,772,47"/>
<area shape="rect"  href="hashes_8c.html#a0feb70b2b982fa8f2a474aa55dab16f0" title=" " alt="" coords="456,13,591,39"/>
<area shape="rect"  href="hashcat_8c.html#ac33e9695b713153c0fc7cce11696704b" title=" " alt="" coords="325,13,408,39"/>
<area shape="rect"  href="hashcat_8c.html#ac49fece3f82732fda9eb29766cc01168" title=" " alt="" coords="104,13,277,39"/>
<area shape="rect"  href="main_8c.html#a3c04138a5bfe5d72780bb7e82a18e627" title=" " alt="" coords="5,13,56,39"/>
</map>
</div>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="abee14193c12696f5c727ef04607b75cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abee14193c12696f5c727ef04607b75cc">&#9670;&nbsp;</a></span>crc32tab</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const u32 crc32tab[256]</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Author......: See docs/credits.txt License.....: MIT </p>

<p class="definition">Definition at line <a class="el" href="cpu__crc32_8c_source.html#l00012">12</a> of file <a class="el" href="cpu__crc32_8c_source.html">cpu_crc32.c</a>.</p>

<p class="reference">Referenced by <a class="el" href="cpu__crc32_8c_source.html#l00080">cpu_crc32()</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
